package ru.inse.core.domain.realty;

import java.util.Date;

import ru.inse.core.domain.BaseEntity;
import ru.inse.core.domain.DateAuditable;


/**
 * Квартира
 * @author evga
 *
 */
public class RealtyItem
    extends BaseEntity
    implements DateAuditable
{
    /**
     * пользователя создавшего объявление
     */
//    private User user;
    /**
     * Дата создания
     */

    private Date cdate;
    
    /**
     * Последнее обновление
     */
    private Date udate;
    
    /**
     * ID города
     */
    private Long cityId;

    
    /**
     * Площадь
     */
    private Integer area;

    /**
     * Цена
     */
    private Integer price;
    
    private RealtyRubric rubric;

    private RealtyObject object;
    
    /**
     * Дополнительная информация
     */
    private String text;
    
    /**
     * Номер квартиры
     */
    private Integer flatNum;

    private Integer i1;

    private Integer i2;
    
    /**
     * Этаж
     */
    private Integer floor;

    /**
     * Этажность
     */
    private Integer floorCount;
    
    /**
     * Улица
     */
    private Long placeId;
    
    /**
     * Номер дома
     */
    private String housNum;

    public Long getCityId()
    {
        return cityId;
    }

    public void setCityId(Long cityId)
    {
        this.cityId = cityId;
    }

    public void setPlaceId(Long placeId)
    {
        this.placeId = placeId;
    }

    public Long getPlaceId()
    {
        return placeId;
    }

    public String getHousNum()
    {
        return housNum;
    }

    public void setHousNum(String housNum)
    {
        this.housNum = housNum;
    }

    public Integer getFlatNum()
    {
        return flatNum;
    }

    public void setFlatNum(Integer flatNum)
    {
        this.flatNum = flatNum;
    }

    public Integer getI1()
    {
        return i1;
    }

    public void setI1(Integer i1)
    {
        this.i1 = i1;
    }

    public Integer getI2()
    {
        return i2;
    }

    public void setI2(Integer i2)
    {
        this.i2 = i2;
    }

    public Integer getFloor()
    {
        return floor;
    }

    public void setFloor(Integer floor)
    {
        this.floor = floor;
    }

    public Integer getFloorCount()
    {
        return floorCount;
    }

    public void setFloorCount(Integer floorCount)
    {
        this.floorCount = floorCount;
    }

  /*  public User getUser()
    {
        return user;
    }

    public void setUser(User user)
    {
        this.user = user;
    }*/

    public Integer getPrice()
    {
        return price;
    }

    public void setPrice(Integer price)
    {
        this.price = price;
    }

    public Integer getArea()
    {
        return area;
    }

    public void setArea(Integer area)
    {
        this.area = area;
    }

    public Date getCdate()
    {
        return cdate;
    }

    public void setCdate(Date cdate)
    {
        this.cdate = cdate;
    }

    public Date getUdate()
    {
        return udate;
    }

    public void setUdate(Date udate)
    {
        this.udate = udate;
    }

    public String getText()
    {
        return text;
    }

    public void setText(String text)
    {
        this.text = text;
    }

    public RealtyRubric getRubric()
    {
        return rubric;
    }

    public void setRubric(RealtyRubric rubric)
    {
        this.rubric = rubric;
    }

    public RealtyObject getObject()
    {
        return object;
    }

    public void setObject(RealtyObject object)
    {
        this.object = object;
    }

    @Override
    public boolean equals(Object o)
    {
        if (!super.equals(o))
        {
            return false;
        }
        RealtyItem other = (RealtyItem)o;
        return equals(getPlaceId(), other.getPlaceId())
            && equals(getHousNum(), other.getHousNum());
    }

    @Override
    public int hashCode()
    {
        int hash = 7;
        hash = accumulateHashCode(hash, getPlaceId());
        hash = accumulateHashCode(hash, getHousNum());
        return hash;
    }

    @Override
    protected void addCustomFieldForToString(StringBuilder sb)
    {
        addFieldToStringBuffer(sb, "placeId", getPlaceId());
        addFieldToStringBuffer(sb, "cityId", getCityId());
        addFieldToStringBuffer(sb, "houseNum", getHousNum());
        addFieldToStringBuffer(sb, "flatNum", getFlatNum());
        addFieldToStringBuffer(sb, "price", getPrice());
        addFieldToStringBuffer(sb, "roomCount", getI1());
    }
}
